﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
//引入命名空间
using stwh_Model;
using stwh_BLL;
using stwh_Common;
using Newtonsoft.Json;
using stwh_Web.Handler.stwh_admin;
using System.Web.SessionState;

namespace stwh_Web.Handler.extend.huodong
{
    /// <summary>
    /// add 的摘要说明
    /// </summary>
    public class add : IHttpHandler, IRequiresSessionState
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            try
            {
                if (context.Session["cjuser"] == null)
                {
                    BaseHandler.SendResponseMsgs(context, "-1", "请登录后操作！", 0);
                    return;
                }
                else
                {
                    string mobile = context.Request["mobile"];
                    if (string.IsNullOrEmpty(mobile))
                    {
                        BaseHandler.SendResponseMsgs(context, "-1", "请提交手机号码！", 0);
                        return;
                    }
                    if (!PageValidate.IsNumber(mobile))
                    {
                        BaseHandler.SendResponseMsgs(context, "-1", "提交的手机号码格式错误！", 0);
                        return;
                    }
                    stwh_cjresult model = new stwh_cjresult();
                    model.stwh_cjraddtime = DateTime.Now;
                    model.stwh_cjrmobile = mobile;
                    new stwh_cjresultBLL().Add(model);
                    BaseHandler.SendResponseMsgs(context, "0", "0", 0);
                }
            }
            catch (Exception)
            {
                BaseHandler.SendResponseMsgs(context, "-1", "服务器异常，请稍后再试！", 0);
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}